package com.hsxc.cdz.monitor.bean.second;

import java.io.UnsupportedEncodingException;

import com.hsxc.cdz.base.util.BytesUtil;

/**
 * 账单上行
 * @author llw
 *
 */
public class BillPileMsg extends SecMessage {

	private String billNO; //交易流水号
	private CP56Time2a startTime; //充电开始时间
	private int chargeTime;    //充电时长
	private int pileTime;  //占桩时长
	private int pileFee;   //占桩时长
	private CP56Time2a leaveTime; //离桩时间
	private byte stageNum;  //阶段数量
	private int[] stage;    //阶段
	private int chargeFee;  //充电费用
	private int serviceFee; //服务费
	
	public static final int length_billNO =32; 
	public static final int length_startTime = 7;
	public static final int length_chargeTime = 2;
	public static final int length_pileTime = 2;
	public static final int length_pileFee = 4;
	public static final int length_leaveTime = 7;
	public static final int length_stageNum = 1;
	public static final int length_stage = 2;
	public static final int length_chargeFee = 4;
	public static final int length_serviceFee = 4;
	/********************************************************/
    public BillPileMsg() {
	}
	public BillPileMsg(byte[] data){
		this.setMessage(data);
	}
	
	/*********************************************************/
	@Override
	public byte[] getMessage() {
		return null;
	}

	@Override
	public boolean execute() {
		return false;
	}
	
	@Override
	public void setMessage(byte[] data) {
		super.setMessage(data);
		try {
			int temp = SecMessage.length;
			this.billNO = new String(BytesUtil.getByte(temp,length_billNO, data), "ascill");
			temp = temp +length_billNO;
			this.startTime = new CP56Time2a(BytesUtil.getByte(temp, length_startTime, data));
			temp = temp+length_startTime;
			this.chargeTime = BytesUtil.bytesToIntDesc(BytesUtil.getByte(temp, length_chargeTime, data));
			temp = temp+length_chargeTime;
			this.pileTime = BytesUtil.bytesToIntDesc(BytesUtil.getByte(temp, length_pileTime, data));
			temp = temp+length_pileTime;
			this.pileFee = BytesUtil.bytesToIntDesc(BytesUtil.getByte(temp, length_pileFee, data));
			temp = temp+length_pileFee;
			this.leaveTime = new CP56Time2a(BytesUtil.getByte(temp, length_leaveTime, data));
			temp = temp+length_leaveTime;
			this.stageNum = data[temp];
			temp = stageNum*length_stage+temp+length_stageNum;
			this.chargeFee = BytesUtil.bytesToIntDesc(BytesUtil.getByte(temp, length_chargeFee, data));
			temp = temp + length_chargeFee;
			this.serviceFee = BytesUtil.bytesToIntDesc(BytesUtil.getByte(temp, length_serviceFee, data));
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
	}

	/****************************************************************************/
	//get() and set()
	public String getBillNO() {
		return billNO;
	}

	public void setBillNO(String billNO) {
		this.billNO = billNO;
	}

	public CP56Time2a getStartTime() {
		return startTime;
	}

	public void setStartTime(CP56Time2a startTime) {
		this.startTime = startTime;
	}

	public int getChargeTime() {
		return chargeTime;
	}

	public void setChargeTime(int chargeTime) {
		this.chargeTime = chargeTime;
	}

	public int getPileTime() {
		return pileTime;
	}

	public void setPileTime(int pileTime) {
		this.pileTime = pileTime;
	}

	public int getPileFee() {
		return pileFee;
	}

	public void setPileFee(int pileFee) {
		this.pileFee = pileFee;
	}

	public CP56Time2a getLeaveTime() {
		return leaveTime;
	}

	public void setLeaveTime(CP56Time2a leaveTime) {
		this.leaveTime = leaveTime;
	}

	public byte getStageNum() {
		return stageNum;
	}

	public void setStageNum(byte stageNum) {
		this.stageNum = stageNum;
	}

	public int[] getStage() {
		return stage;
	}

	public void setStage(int[] stage) {
		this.stage = stage;
	}

	public int getChargeFee() {
		return chargeFee;
	}

	public void setChargeFee(int chargeFee) {
		this.chargeFee = chargeFee;
	}

	public int getServiceFee() {
		return serviceFee;
	}

	public void setServiceFee(int serviceFee) {
		this.serviceFee = serviceFee;
	}
}
